<?php
///usr/local/phpsh/bin/php msg_c.php
define('base_path' , dirname(__FILE__));
include(base_path.'/msg.php');

$msg1 = new msg(1000001,false);
$msg2 = new msg(2000001,false);

while(1){	
	$data = substr('An example using the optional file and line parameters, as of PHP 4.3.0',0,rand(5,20));
	echo $data.chr(10);
	$str = $msg1->send($data, rand(1,10));
	$str = $msg2->receive(true, $type);
	if($str)
		echo 'C response:'.$str.chr(10);
	usleep(500000);
}
